﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WeifenLuo.WinFormsUI.Docking;
using System.Windows.Forms;

namespace ToolGenerateDiagram
{
    public class FormManager
    {
        public static DialogResult ShowMessageBox(string text, MessageBoxButtons button, MessageBoxIcon icon)
        {
            return MessageBox.Show(text, "Generate Diagram Tool", button, icon);
        }
        public static IDockContent FindDocument(string text, DockContent form)
        {
            if (form.DockPanel.DocumentStyle == DocumentStyle.SystemMdi)
            {
                foreach (var item in form.MdiChildren)
                {
                    if (item.Text == text)
                        return item as IDockContent;
                }
            }
            else
            {
                //Close all form have dockstyle is document
                foreach (var content in form.DockPanel.Documents)
                {
                    if (content.DockHandler.TabText == text)
                        return content;
                }
            }
            return null;

        }


    }
}
